export default {
    state: {
        rolelist: [],
        page: 1,
        size: 30,
        total: 0
    },
    getters: {
        getters_rolelist(state) {
            return state.rolelist;
        },
        getters_page(state) {
            return state.page;
        },
        getters_total(state) {
            return state.total;
        }
    },
    mutations: {
        mutations_rolelist(state, payload) {
            state.rolelist = payload;
        },
        mutations_page(state, payload) {
            state.page = payload;
        },
        mutations_total(state, payload) {
            state.total = payload;
        }
    },
    actions: {
        async actions_rolelist(context, payload) {
            try {
                // let data = {
                //     page: context.state.page,
                //     size: context.state.size
                // }
                // let res = await get_rolelist(data);
                // if (res.code == 200) {
                //     // 最后一页
                //     if (res.list == null && context.state.page != 1) {
                //         context.commit('mutations_page', context.state.page - 1);
                //         context.dispatch('actions_rolelist');
                //     } else {
                //         context.commit('mutations_rolelist', res.list);
                //         context.commit('mutations_total', res.total);
                //     }
                // }
            } catch (e) {
                console.log(e);
            }
        }
    },
    namespaced: true
}